#include<bits/stdc++.h>

using namespace std;
int a[100][100];
int n;

bool up(int &x, int &y) {
    int nx = (x - 1 + n) % n;
    int ny = y % n;
    if (a[nx][ny] != 0)return false;
    x = nx;
    y = ny;
    return true;
}

bool right_down(int &x, int &y) {
    int nx = (x + 1) % n;
    int ny = (y + 1) % n;
    if (a[nx][ny] != 0)return false;
    x = nx;
    y = ny;
    return true;
}

int main() {
    while (cin >> n) {
        if (n == 0)break;
        memset(a, 0, sizeof(a));

        int x = n - 1, y = n / 2;
        int k = 1;
        a[x][y] = k++;
        while (k <= n * n) {
            while (k <= n * n && right_down(x, y))a[x][y] = k++;
            if (k <= n * n && up(x, y))a[x][y] = k++;
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                cout << a[i][j] << " ";
            }
            cout << endl;
        }
    }
    return 0;
}